home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Source Code / Libraries / ABox 1.9.5 / Header Files / ABTopic.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-10-26  |  6.5 KB  |  223 lines  |  [TEXT/MMCC]

  1. /*    
  2.     Copyright © 1991-1995 by TopSoft Inc.  All rights reserved.
  3.  
  4.     You may distribute this file under the terms of the TopSoft
  5.     Artistic License, accompanying this package.
  6.     
  7.     This file was developed by George (ty) Tempel in connection with TopSoft, Inc..
  8.     See the Modification History for more details.
  9.  
  10. Product
  11.     About Box
  12.  
  13. FILE
  14.     ABTopic.h
  15.  
  16. NAME
  17.     ABTopic.h, part of the ABox project source code,
  18.     responsible for handling the AboutBox topic class stuff.
  19.  
  20. DESCRIPTION
  21.     This file contains defines for the about box modules.
  22.     
  23. DEVELOPED BY
  24.     George (ty) Tempel                ttempel@monmouth.com
  25.     All code in this file, and its associated header file was
  26.     Created by George (ty) Tempel in connection with the TopSoft, Inc.
  27.     "FilterTop" application development, except where noted.
  28.  
  29. CARETAKER - George (ty) Tempel <ttempel@monmouth.com>
  30.      Please consult this person for any changes or suggestions to this file.
  31.  
  32. MODIFICATION HISTORY
  33.  
  34.     dd mmm yy    -    xxx    -    patchxx: description of patch
  35.     9 June 94    -    ty    -    Initial Version Created
  36.     20-july-94    -    ty    -    initial version released
  37.     28-july-94    -    ty    -    1.0.6---removed the cursor stuff to the
  38.                                 mix-in class ABUCursor
  39.     23-may-95    -    ty    -    changes for compatibility with the CodeWarrior CW6
  40.                             release and the associated Universal Headers from Apple:
  41.                             most methods that returned references now have "Ref" at
  42.                             the end of their methods names to prevent possible collisions
  43.                             with datatypes and classes of the same name (older versions
  44.                             of the compiler didn't have a problem with this).
  45.     25-oct-95    -    ty    -    changes for "const" usage under CW7; simplification of Boolean
  46.                             query methods
  47.  
  48. */
  49.  
  50. /*===========================================================================*/
  51.  
  52. /*========== Exclusion Macros ============*/
  53.  
  54. #pragma    once
  55.  
  56. #ifndef    _ABTopic_
  57. #define    _ABTopic_
  58.  
  59.  
  60. /*============ Header Files ==============*/
  61.  
  62. #include    "ABLinkedList.h"
  63. #include    "ABObject.h"
  64. #include    "ABSlide.h"
  65.  
  66. /*=========== External Linkage ===========*/
  67.  
  68. /*================ Macros ================*/
  69.  
  70. /*============== Constants ===============*/
  71.  
  72. //    kABTopicSlideResource is the topic/slide resource, found in every file 
  73. //    that should appear in the about box topic list (including the application
  74. //    if you wish to have default or primary slides).
  75. //
  76. #define    kABTopicSlideResource        'TSAb'
  77.  
  78.  
  79. /*================ Enums =================*/
  80.  
  81. enum ETopicType { ETopicType_OtherTopic, ETopicType_Topic, ETopicType_MovieTopic };
  82.  
  83. //    these are properties...
  84.  
  85. #define    kABTopicIndex                'Tidx'
  86. #define    kABTopicIndexSize            (sizeof(ABIndex))
  87.  
  88. #define    kABTopicNumberOfSlides        'Tnsl'
  89. #define    kABTopicNumberOfSlidesSize    (sizeof(ABListCount))
  90.  
  91. #define    kABTopicFSSpec                'Tfss'
  92. #define    kABTopicFSSpecSize            (sizeof(FSSpec))
  93.  
  94. #define    kABTopicName                'Tnam'
  95. #define    kABTopicNameSize            (sizeof(Str255))
  96.  
  97. #define    kABTopicDepth                'Tdep'
  98. #define    kABTopicDepthSize            (sizeof(long))
  99.  
  100. #define    kABTopicType                'Ttyp'
  101. #define    kABTopicTypeSize            (sizeof(ETopicType))
  102.  
  103. #define    kABBadTopicFileRefNum        ((short)-1)
  104.  
  105. /*=============== Structs ================*/
  106.  
  107. /*=============== Typedefs ===============*/
  108.  
  109. /*=========== Class Definitions ==========*/
  110.  
  111. #define    kABTopicSuperProperties    ABObject
  112. class    ABTopic : public ABLink, public ABObject
  113. {
  114.     friend class ABTopicList;
  115.     
  116.     public:
  117.                                 ABTopic(void);
  118.                                 ABTopic(const FSSpec& inTopicFSSpec);
  119.         virtual                    ~ABTopic(void);
  120.  
  121.         virtual    OSErr            GetProperty (ABProperty prop, 
  122.                                             void *ptr, 
  123.                                             long *ptrSize);
  124.         virtual    OSErr            SetProperty (ABProperty prop, 
  125.                                             void *ptr, 
  126.                                             long ptrSize);
  127.         
  128.         virtual    OSErr            Draw(WindowPtr window);
  129.         virtual    OSErr            Update(WindowPtr window);
  130.         virtual    Boolean            Event(EventRecord *event);
  131.         virtual    OSErr            Stop(void);
  132.         
  133.         virtual    OSErr            NextSlide(void);
  134.         virtual    OSErr            PreviousSlide(void);
  135.         virtual    ABSlide*        CurrentSlide(void);
  136.         virtual    OSErr            GotoSlide(long number);
  137.         
  138.         virtual    OSErr            Resize (Rect const *field);
  139.         
  140.                 OSErr            ResizeAndDraw(Rect& inItemRect, WindowPtr inWindow); 
  141.                 
  142.                 Boolean            HasName(void) const { return this->NameRef() != NULL; }
  143.                 StringPtr        GetName(void) const { return this->NameRef(); }
  144.                 
  145.                 Boolean            HasSlides(void) const { return this->SlidesRef() != NULL; }
  146.                 
  147.                 Boolean            HasFSSpecPointer(void) const { return this->FSSpecPointerRef() != NULL; }
  148.                 Boolean            DoesntHaveFSSpecPointer(void) const { return ! this->HasFSSpecPointer(); }
  149.                 
  150.                 Boolean            HasValidFileRefNum(void) const { return this->FileRefNumRef() != kABBadTopicFileRefNum; }
  151.  
  152.                 Boolean            HasFileRefNum(void) const { return this->FileRefNumRef() != kABBadTopicFileRefNum && this->FileRefNumRef() > 0; }
  153.                 
  154.                 long            GetDepth(void) const { return this->Depth(); }
  155.                 long            SetDepth(long inDepth) { return this->Depth() = inDepth; }
  156.                 
  157.     protected:
  158.                 void            ResetFileInfo(void);
  159.                 void            ResetFileRefNum(void);
  160.                 void            ResetFSSpecPointer(void);
  161.                 void            ResetSlideInfo(void);
  162.                 
  163.                 OSErr            Load (void);
  164.                 OSErr            Load (short inFileRefNumber);
  165.         
  166.         //    every subclass of ABTopic overrides the DoLoad and DoCheckSlides methods
  167.         //    to provide their own functionality.
  168.         virtual    OSErr            DoLoad (void);
  169.         virtual    short            DoCheckSlides (void);
  170.  
  171.         virtual    OSErr            CheckAndCopyFSSpec (const FSSpec& file);
  172.     
  173.                 short            UseTopicResFile(void) const;
  174.  
  175.         virtual    OSErr            OpenTopic (void);
  176.         virtual    OSErr            CloseTopic (void);
  177.                 OSErr            CloseTopicFile (void);
  178.                 OSErr            CloseTopicFile (OSErr inError);
  179.         
  180.                 StringPtr        mName;
  181.                 ABLinkedList*    mSlides;
  182.                 FSSpecPtr        mFSSpecPtr;
  183.                 long            mDepth;
  184.                 short            mFileRefNum;
  185.                 ETopicType        mTopicType;
  186.                 
  187.                 StringPtr&                NameRef(void)          { return this->mName; }
  188.                 StringPtr const&        NameRef(void) const { return this->mName; }
  189.  
  190.                 ABLinkedList*&            SlidesRef(void)          { return this->mSlides; }
  191.                 ABLinkedList* const&    SlidesRef(void) const { return this->mSlides; }
  192.  
  193.                 FSSpecPtr&                FSSpecPointerRef(void)          { return this->mFSSpecPtr; }
  194.                 FSSpecPtr const&        FSSpecPointerRef(void) const { return this->mFSSpecPtr; }
  195.  
  196.                 long&            Depth(void)          { return this->mDepth; }
  197.                 long const&        Depth(void) const { return this->mDepth; }
  198.  
  199.                 short&                FileRefNumRef(void)      { return this->mFileRefNum; }
  200.                 short const&        FileRefNumRef(void) const { return this->mFileRefNum; }
  201.  
  202.                 short                GetFileRefNum(void) const { return this->FileRefNumRef(); }
  203.  
  204.                 ETopicType&            TopicType(void)      { return this->mTopicType; }
  205.                 ETopicType const&    TopicType(void) const { return this->mTopicType; }
  206.  
  207.     private:
  208.                 void            InitializeTopic(void);
  209. };
  210.  
  211.  
  212.  
  213.  
  214.  
  215.  
  216. /*========== Function Prototypes =========*/
  217.  
  218.  
  219.  
  220.  
  221. #endif    // _ABTopic_
  222.  
  223.